1 Transects

Plant Flowers Date lon lat ele Month Year julian
Glossoloma oblongicalyx 4 2015-10-19 -78.59093 0.130838 2270 October 2015 292
Gasteranthus quitensis 2 2016-10-17 -78.59770 0.120070 1940 October 2016 291
Kohleria affinis 1 2016-12-13 -78.59534 0.126746 2110 December 2016 348
Columnea ciliata 3 2014-02-27 -78.59934 0.116682 1960 February 2014 58
Columnea medicinalis 1 2014-04-23 -78.59372 0.128700 2130 April 2014 113
Drymonia teuscheri 3 2016-07-28 -78.59245 0.129393 2200 July 2016 210

2 Phylogeny

2.0.1 Total Flowers

Peak date

3 Count model of species phenology

3.1 Infer absences

3.2 Julian Day

## sink("model/julian.jags")
## cat("
##     model {
##     
##     for (x in 1:Nobs){
##     
##     #observation
##     log(phi[x])<-alpha[Plant[x]]  + beta[Plant[x]] * julian[x] + beta2[Plant[x]] * julian[x]^2
##     
##     Yobs[x] ~ dpois(phi[x])
##     
##     }
##     
##     #phylogenetic covariance among plants
##     #covert variance to precision
##     #tauC[1:Plants,1:Plants]=inverse((sigma^2)*C[,])
##     
##     #e[1:Plants] ~ dmnorm(zeros[],tauC[,])
##     
##     #Effect of phylogeny, calculate pagels lambda using variance-covariance matrix and identity matrix
##     #C[1:Plants,1:Plants] = lambda * vcov[,] + (1-lambda) * I[,]
##     
##     #Assess Model Fit
##     #Priors
##     
##     #Species level priors
##     
##     for (j in 1:Plants){
##     
##       #Intercept
##       #poisson regression prior
##       beta[j] ~ dnorm(0,0.0001)
##       beta2[j] ~ dnorm(0,0.0001)
##       alpha[j] ~ dnorm(0,0.0001)
##     } 
##     
##     #pagels lambda
##     #lambda ~ dbeta(1,1)
##     
##     #variance in phylogenetic effect
##     #sigma ~ dunif(0,10)
##     
##     #Prediction
## 
## 
##     }
##     ",fill=TRUE)
## 
## sink()
## Compiling model graph
##    Resolving undeclared variables
##    Allocating nodes
## Graph information:
##    Observed stochastic nodes: 4267
##    Unobserved stochastic nodes: 51
##    Total graph size: 25691
## 
## Initializing model

4 Get Chains

4.0.1 Evaluate convergence

4.0.2 Posterior estimates

4.0.3 Effect of Julian day

4.1 Julian + Phylogenetic Attraction

## sink("model/julian_phylogeny.jags")
## cat("
##     model {
##     
##     #observation - species specific intercept and phylogenetic covariance in julian day
## 
##     for (x in 1:Nobs){
##     
##       log(phi[x])<- alpha[Plant[x]]  + beta[Plant[x]] * julian[x] + beta2[Plant[x]] * julian[x]^2
##       
##       Yobs[x] ~ dpois(phi[x])
##     
##     }
## 
##     #species-specific responses to julian day. Polynomial model.
## 
##     #beta 1
##     beta[1:Plants] ~ dmnorm(zeros[],tauC[,])
##     beta2[1:Plants] ~ dmnorm(zeros[],tauC2[,])
## 
##     ##Phylogenetic covariance in effect of julian day
##     #Effect of phylogeny, calculate pagels lambda using variance-covariance matrix and identity matrix
##     
##     C[1:Plants,1:Plants] = lambda * vcov[,] + (1-lambda) * I[,]
## 
##     ## Since the response to julian is X^2 polynomial, need phylogenetic effects on both terms.
##     ## These terms share everything except for the scaling factor sigma. The phylogenetic signal is the same. 
##     ## covert variance to precision for each parameter
## 
##     tauC[1:Plants,1:Plants]=inverse((sigma^2)*C[,])
##     tauC2[1:Plants,1:Plants]=inverse((sigma2^2)*C[,])
## 
##     ## **************************
##     ##         Priors
##     ## **************************
##     
##     #Species level priors
##     
##     for (j in 1:Plants){
##       
##       #Intercept
##       alpha[j] ~ dnorm(0,0.0001)
##     } 
##     
##     #pagels lambda
##     lambda ~ dbeta(1,1)
##     
##     #variance in phylogenetic effect
##     #beta term
##     sigma ~ dunif(0,10)
##     #beta2 term
##     sigma2 ~ dunif(0,10)
## 
##     
##     
##     }
##     ",fill=TRUE)
## 
## sink()
## Compiling model graph
##    Resolving undeclared variables
##    Allocating nodes
## Graph information:
##    Observed stochastic nodes: 3514
##    Unobserved stochastic nodes: 19
##    Total graph size: 21617
## 
## Initializing model

5 Get Chains

5.0.1 Evaluate convergence

5.0.2 Posterior estimates

5.0.3 Effect of Julian day

5.1 Julian + Phylogenetic Repulsion

## sink("model/julian_phylogeny.jags")
## cat("
##     model {
##     
##     #observation - species specific intercept and phylogenetic covariance in julian day
## 
##     for (x in 1:Nobs){
##     
##       log(phi[x])<- alpha[Plant[x]]  + beta[Plant[x]] * julian[x] + beta2[Plant[x]] * julian[x]^2
##       
##       Yobs[x] ~ dpois(phi[x])
##     
##     }
## 
##     #species-specific responses to julian day. Polynomial model.
## 
##     #beta 1
##     beta[1:Plants] ~ dmnorm(zeros[],tauC[,])
##     beta2[1:Plants] ~ dmnorm(zeros[],tauC2[,])
## 
##     ##Phylogenetic covariance in effect of julian day
##     #Effect of phylogeny, calculate pagels lambda using variance-covariance matrix and identity matrix
##     
##     C[1:Plants,1:Plants] = lambda * vcov[,] + (1-lambda) * I[,]
## 
##     ## Since the response to julian is X^2 polynomial, need phylogenetic effects on both terms.
##     ## These terms share everything except for the scaling factor sigma. The phylogenetic signal is the same. 
##     ## covert variance to precision for each parameter
## 
##     tauC[1:Plants,1:Plants]=inverse((sigma^2)*C[,])
##     tauC2[1:Plants,1:Plants]=inverse((sigma2^2)*C[,])
## 
##     ## **************************
##     ##         Priors
##     ## **************************
##     
##     #Species level priors
##     
##     for (j in 1:Plants){
##       
##       #Intercept
##       alpha[j] ~ dnorm(0,0.0001)
##     } 
##     
##     #pagels lambda
##     lambda ~ dbeta(1,1)
##     
##     #variance in phylogenetic effect
##     #beta term
##     sigma ~ dunif(0,10)
##     #beta2 term
##     sigma2 ~ dunif(0,10)
## 
##     
##     
##     }
##     ",fill=TRUE)
## 
## sink()
## Compiling model graph
##    Resolving undeclared variables
##    Allocating nodes
## Graph information:
##    Observed stochastic nodes: 3514
##    Unobserved stochastic nodes: 19
##    Total graph size: 21617
## 
## Initializing model

6 Get Chains

6.0.1 Evaluate convergence

6.0.2 Posterior estimates

6.0.3 Effect of Julian day

7 Model Comparison

7.1 Effect of julian day

8 Model Fit

8.1 Overall

8.2 By Species

9 Prediction

Todo